<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
    <input type="file" id="upLoad">
    <script>
        $('#upLoad').change(function(e) {
          var data = new FormData();  //创建formData，以formData形式提交到后台
          var info = $('#upLoad')[0].files[0];
          data.append('upload',info); //用formData的append方法添加内容
          $.ajax({
            url: '/upload',
            type: 'POST',
            data: data,
            cache: false,
            contentType: false, //不可缺参数
            processData: false, //不可缺参数
            success: function(data) {
               console.log(data);
            },
            error: function() {
              console.log('error');
            }
         });
        })
    </script>
</body>
</html>